package mfuny.ggongal.admin;

import mfuny.ggongal.admin.policy.PolicyDao;
import mfuny.ggongal.admin.policy.PolicyService;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class PolicyController {
	PolicyService policy;
	
	public PolicyController() throws Exception {
		policy = new PolicyService();
	}
	
	@RequestMapping("/policyList.ga")
	public ModelAndView policyList() throws Exception {
		return policy.policyList();
	}
	
	@RequestMapping("/getPolicyList.ga")
	public ModelAndView getPolicyList(String param) throws Exception {
		return policy.getPolicyList(param);
	}
	
	@RequestMapping("/regPolicyForm.ga")
	public ModelAndView regPolicyForm() throws Exception {
		return policy.regPolicyForm();
	}
	
	@RequestMapping("/regPolicy.ga")
	public ModelAndView regPolicy(@ModelAttribute PolicyDao policyDao) throws Exception {
		return policy.regPolicy(policyDao);
	}
	
	@RequestMapping("/readPolicy.ga")
	public ModelAndView readPolicy(int policy_no) throws Exception {
		return policy.readPolicy(policy_no);
	}
	
	@RequestMapping("/modifyPolicyForm.ga")
	public ModelAndView modifyPolicyForm(int policy_no) throws Exception {
		return policy.modifyPolicyForm(policy_no);
	}
	
	@RequestMapping("/modifyPolicy.ga")
	public ModelAndView modifyPolicy(@ModelAttribute PolicyDao policyDao) throws Exception {
		return policy.modifyPolicy(policyDao);
	}
}
